]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Limit number of buttons in banners
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 17 Feb 2015 02:53:00 +0000 (03:53 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 20 Feb 2015 16:41:56 +0000 (17:41 +0100)
The design states that notifications should have a maximum of three
buttons, so enforce this in the new banner actors.

js/ui/messageTray.js

index 32f8578ddf391fb797a996e7011f6ac06c06951b..b8b45ff042e3a3bde8d1761f6ad52e57f42d2c4a 100644 (file)
@@ -30,6 +30,7 @@ const LONGER_HIDE_TIMEOUT = 0.6;
 
 const MAX_NOTIFICATIONS_IN_QUEUE = 3;
 const MAX_NOTIFICATIONS_PER_SOURCE = 3;
+const MAX_NOTIFICATION_BUTTONS = 3;
 
 // We delay hiding of the tray if the mouse is within MOUSE_LEFT_ACTOR_THRESHOLD
 // range from the point where it left the tray.
@@ -1170,6 +1171,9 @@ const NotificationBanner = new Lang.Class({
             global.focus_manager.add_group(this._buttonBox);
         }
 
+        if (this._buttonBox.get_n_children() >= MAX_NOTIFICATION_BUTTONS)
+            return null;
+
         this._buttonBox.add(button);
         button.connect('clicked', Lang.bind(this, function() {
             callback();